// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.worldMap;

import gnu.trove.list.array.TIntArrayList;
import zombie.core.math.PZMath;

public final class WorldMapPoints extends TIntArrayList {
    int m_minX;
    int m_minY;
    int m_maxX;
    int m_maxY;

    public int numPoints() {
        return this.size() / 2;
    }

    public int getX(int index) {
        return this.get(index * 2);
    }

    public int getY(int index) {
        return this.get(index * 2 + 1);
    }

    public void calculateBounds() {
        this.m_minX = this.m_minY = Integer.MAX_VALUE;
        this.m_maxX = this.m_maxY = Integer.MIN_VALUE;

        for (int int0 = 0; int0 < this.numPoints(); int0++) {
            int int1 = this.getX(int0);
            int int2 = this.getY(int0);
            this.m_minX = PZMath.min(this.m_minX, int1);
            this.m_minY = PZMath.min(this.m_minY, int2);
            this.m_maxX = PZMath.max(this.m_maxX, int1);
            this.m_maxY = PZMath.max(this.m_maxY, int2);
        }
    }

    public boolean isClockwise() {
        float _float = 0.0F;

        for (int int0 = 0; int0 < this.numPoints(); int0++) {
            int int1 = this.getX(int0);
            int int2 = this.getY(int0);
            int int3 = this.getX((int0 + 1) % this.numPoints());
            int int4 = this.getY((int0 + 1) % this.numPoints());
            _float += (float)((int3 - int1) * (int4 + int2));
        }

        return (double)_float > 0.0;
    }
}
